<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片压缩工具</title>
    <link rel="stylesheet" href="styles.css">
    <!-- 引入苹果风格图标库 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
</head>
<body>
    <!-- 顶部导航栏 -->
    <header>
        <div class="container">
            <h1><i class="fas fa-compress-alt"></i> 图片压缩工具</h1>
            <p>快速、高效地压缩您的图片，保持高质量</p>
        </div>
    </header>

    <!-- 主要内容区域 -->
    <main class="container">
        <!-- 上传区域 -->
        <section class="upload-container" id="upload-area">
            <div class="upload-box" id="drop-area">
                <i class="fas fa-cloud-upload-alt"></i>
                <h3>拖放图片至此处或点击上传</h3>
                <p>支持 PNG、JPG 等格式</p>
                <input type="file" id="file-input" accept="image/*" hidden>
                <button class="btn primary" id="select-button">选择图片</button>
            </div>
        </section>

        <!-- 图片处理区域（初始隐藏） -->
        <section class="image-processing" id="processing-area" style="display: none;">
            <!-- 调整压缩比例 -->
            <div class="compression-settings">
                <h3>压缩设置</h3>
                <div class="slider-container">
                    <label for="quality-slider">压缩质量：<span id="quality-value">80</span>%</label>
                    <input type="range" id="quality-slider" min="1" max="100" value="80" class="slider">
                </div>
                <div class="format-selector">
                    <label for="format-select">输出格式：</label>
                    <select id="format-select">
                        <option value="jpeg">JPEG</option>
                        <option value="png">PNG</option>
                        <option value="webp">WebP</option>
                    </select>
                </div>
                <button class="btn primary" id="compress-button">压缩图片</button>
            </div>

            <!-- 图片预览区域 -->
            <div class="preview-container">
                <div class="preview-box">
                    <h3>原图预览</h3>
                    <div class="image-preview" id="original-preview">
                        <img id="original-image" src="" alt="原图预览">
                    </div>
                    <div class="file-info" id="original-info">
                        <p>文件大小：<span id="original-size">0 KB</span></p>
                        <p>图片尺寸：<span id="original-dimensions">0 x 0</span></p>
                    </div>
                </div>

                <div class="preview-box">
                    <h3>压缩后预览</h3>
                    <div class="image-preview" id="compressed-preview">
                        <img id="compressed-image" src="" alt="压缩后预览">
                    </div>
                    <div class="file-info" id="compressed-info">
                        <p>文件大小：<span id="compressed-size">0 KB</span></p>
                        <p>压缩比例：<span id="compression-ratio">0%</span></p>
                    </div>
                    <button class="btn primary" id="download-button" disabled>下载图片</button>
                </div>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer>
        <div class="container">
            <p>© 2023 图片压缩工具 | 简单高效的在线图片压缩服务</p>
        </div>
    </footer>

    <script src="script.js"></script>
</body>
</html> 